﻿using BPMN.Domain.ActionResult;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPMN.Domid.Share.AuditResult
{
    //封装返回Dto
    public class ResultDto<T>
    {
        /// <summary>
        /// 是否成功
        /// </summary>
        public bool Success => Code == ResultCode.Ok;
        /// <summary>
        /// 结果码
        /// </summary>
        public ResultCode Code { get; set; }
        /// <summary>
        /// 提示信息
        /// </summary>
        public string Message { get; set; }
        /// <summary>
        /// 返回业务数据
        /// </summary>
        public T Data { get; set; }
        /// <summary>
        /// 成功用的构造函数
        /// </summary>
        public ResultDto()
        {
            Code = ResultCode.Ok;
            Message = "操作成功";
        }
       /// <summary>
       /// 
       /// </summary>
       /// <param name="code"></param>
       /// <param name="message"></param>
        public ResultDto(ResultCode code,string message)
        {
            Code = code;
            Message = message;
        }

    }
}
